Skip to content

SettingsPropertyHelper class

Defined in

Namespace: Akavache.Settings.Core Assembly: Akavache.Settings.dll Full name: Akavache.Settings.Core.SettingsPropertyHelper<T> Modifiers: public sealed

Summary

Lightweight sync-readable wrapper around a settings SettingsStream. Exposes a latest-value Value accessor (so derived SettingsStorage classes can still publish plain-C# properties), an IObservable surface (so reactive consumers can subscribe), a Set method (for writes), INotifyPropertyChanged notifications (so WPF/MAUI data bindings to BoolTest.Value update automatically), and an implicit conversion to T (so comparisons and assignments read naturally without .Value).

Applies to

net10.0, net10.0-tvos26.0, net10.0-maccatalyst26.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net10.0-android36.0, net10.0-ios26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net9.0, net9.0-windows10.0.19041, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net481, net462

Class hierarchy
classDiagram
class SettingsPropertyHelper~T~
class IObservable~T~ {
    <>
}
IObservable~T~ <|.. SettingsPropertyHelper~T~
class INotifyPropertyChanged {
    <>
}
INotifyPropertyChanged <|.. SettingsPropertyHelper~T~
class IDisposable {
    <>
}
IDisposable <|.. SettingsPropertyHelper~T~

Implements: IObservable, INotifyPropertyChanged, IDisposable

Remarks

Deliberately simpler than ReactiveUI's ObservableAsPropertyHelper<T> — no scheduler plumbing, no thrown-exception observable, no deferred subscription mode. Settings properties are long-lived, low-frequency, and single-subject; the extra ceremony buys nothing here.

Typical derived usage:

public sealed class MySettings : SettingsBase
 {
 public MySettings() : base(nameof(MySettings))
 {
 Enabled = CreateProperty(true, nameof(Enabled));
 }
 
 public SettingsPropertyHelper<bool> Enabled { get; }
 }
 
 // Consumers
 bool enabled = settings.Enabled; // implicit conversion, sync
 var current = settings.Enabled.Value; // explicit sync read
 if (settings.Enabled) { ... } // condition, implicit
 settings.Enabled.Subscribe(v => Log(v)); // reactive
 await settings.Enabled.Set(false); // write + commit

Properties

NameSummary
ValueGets the latest value published by the underlying stream. Reads are synchronous and allocation-free; the value is kept up to date by an internal subscription.

Methods

NameSummary
ToTNamed alternate for the implicit conversion operator, required by CA2225 for languages that can't invoke user-defined implicit operators. Equivalent to ...
SetWrites a new value through to the underlying blob cache. The returned observable fires [Unit](# once the persistent write has been accepted, or errors if the cache insert...
Subscribe
Dispose

Operators

NameSummary
static op_ImplicitImplicit conversion from the helper to the underlying value type. Lets callers write bool enabled = settings.Enabled;, if (settings.Enabled) { ... }, or settings.IntValue == 5 without...

Events

NameSummary
PropertyChangedOccurs when [Value](# changes. Fires with "Value" as the property name so WPF/MAUI data bindings to MyProperty.Value update automatically.
Inherited members